package com.gemalto.Kryptik.Gui;

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

class PopupMenu extends JPopupMenu implements ActionListener {

	private int index;
	private DetachableTabbedPane parent;
	
	public PopupMenu (DetachableTabbedPane parent){
		this.parent = parent;
		JMenuItem item = new JMenuItem("Undock");
		item.addActionListener(this);
		add(item);
	}

	public void actionPerformed(ActionEvent e){
		parent.undockTab(index);		
	}


	public void setIndex(int index){
		this.index = index;
	}

	public void show(Component c, int x, int y, int index ){
		super.show(c,x,y);
		this.index = index;
	}
}
